﻿using System;
using System.Threading.Tasks;
using HttpService;
using QueryPath.Web.MSDN;
using Microsoft.Extensions.DependencyInjection;
using DataSave.Web.MSDN;
using Microsoft.Extensions.Configuration;
using DataSave.RedisClient;
using DataSave.ConfigurationBase;

namespace Reptile
{
    class Program
    {
        static void Main(string[] args)
        {

            IServiceCollection services = new ServiceCollection();
            //注入
            services.AddSingleton<IConfigBase, ConfigBase>();
            services.AddTransient<IRedisService, RedisService>();
            services.AddTransient<IReptileService, ReptileService>();
            services.AddTransient<IWebMSDN, WebMSDN>();
            services.AddTransient<IForRedisService, ForRedisService>();
            //构建容器
            IServiceProvider serviceProvider = services.BuildServiceProvider();
            //解析
            var ReptileMSDN = serviceProvider.GetService<IWebMSDN>();
            var first = Task.Run(async () =>await ReptileMSDN.GetMSDNAllDataAsync());
            first.Wait();
            Console.WriteLine("结束了！");
            Console.ReadKey();
        }
    }
}
